﻿@{
    ViewBag.Title = "Accessory";
    ViewBag.BackUrl = Url.Action("Accessories", "Product");
    LineFocus.Nikcron.Models.Lookup Manufactures = ViewBag.Manufactures;
    LineFocus.Nikcron.Models.Lookup AccessoryTypes = ViewBag.AccessoryTypes;
}
@model Nickron.Database.Accessory

@using (Html.BeginForm("AccessoryMaintenace", "Product", FormMethod.Post, new { onsubmit = "return ValidateForm();" }))
{

    <div class="col-md-12">
        <div class="box box-danger">
            <div class="box-body">

                <div class="box-header">
                    <h3 class="box-title"> General Feature</h3>
                </div>

                <div class="form-group">
                    <label>Product Date:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class="fa fa-calendar"></i>
                        </div>
                        <input name="ProductDate" id="ProductDate" type="text" data-mask="" data-inputmask="'alias': 'dd/mm/yyyy'" class="form-control">
                    </div><!-- /.input group -->
                </div><!-- /.form group -->
                
                <div class="form-group">
                    <label>Accessory Type:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <select id="AccessoryType" name="AccessoryType" class="selectpicker" title="Select Accessory Type">
                            @Html.Partial("Dropdown", AccessoryTypes)
                        </select>
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>In The Box:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="InBox" name="InBox" type="text" maxlength="1000" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Model Number:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="ModelNumber" name="ModelNumber" maxlength="200" type="text" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Model Name:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="ModelName" name="ModelName" type="text" maxlength="500" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Manufacture:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <select id="Manufacture" name="Manufacture" class="selectpicker" title="Select Manufacture">
                            @Html.Partial("Dropdown", Manufactures)
                        </select>
                    </div><!-- /.input group -->
                </div><!-- /.form group -->
                
                <div class="form-group">
                    <label>MRP:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="MRP" name="MRP" type="number" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">Dimensions</h3>
                </div>

                <div class="form-group">
                    <label>Size:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="Dimension" name="Dimension" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="form-group">
                    <label>Weight:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <input id="Weight" name="Weight" type="text" maxlength="100" class="form-control pull-right" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">OTHER FEATURES</h3>
                </div>

                <div class="form-group">
                    <label>Additional Features:</label>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <textarea id="NoteSummary" name="NoteSummary" maxlength="1000" class="form-control pull-right"></textarea>
                    </div><!-- /.input group -->
                </div><!-- /.form group -->

                <div class="box-header">
                    <h3 class="box-title">WARRANTY</h3>
                </div>

                <div class="form-group">
                    <label>WarrantySummary:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i></i>
                        </div>
                        <textarea id="WarrantySummary" name="WarrantySummary" maxlength="1000" class="form-control pull-right"></textarea>
                    </div><!-- /.input group -->
                </div><!-- /.form group -->
                
                

                <div class="box box-success">
                    <div class="box-footer">
                        <input type="hidden" name="Id" id="Id" value="@ViewBag.Id" />
                        <button type="submit" class="btn btn-primary" style=" width:80px;">Save</button>
                        <button type="reset" class="btn btn-primary" onclick="GoBackListing()" style=" width:80px;">Cancel</button>
                    </div>
                </div><!-- /.box -->
            </div><!-- /.box-body -->
        </div><!-- /.box -->
    </div><!-- /.col (left) -->

    <script>
         function GoBackListing() {
             window.location.replace('@Url.Action("Tablets","Product",null)');
         }
    function ValidateForm() {
        RequiredDropdown("AccessoryType", -1, "Select an Accessory Type");
        RequiredTextbox("ModelNumber", "Enter the Model Number")
        RequiredTextbox("ModelName", "Enter the Model Name")
        RequiredDropdown("Manufacture", -1, "Select a Manufacture");
        RequiredTextbox("Dimension", "Enter the Dimention Size");
        RequiredTextbox("Weight", "Enter the Dimention Weight");
        RequiredTextbox("WarrantySummary", "Enter the Warranty Summary");
        RequiredTextbox("MRP", "Enter MRP");
        return AlertError();
    }

    $(document).ready(function () {
        $('.selectpicker').selectpicker();
        $('#ProductDate').datepicker();
        if ("@ViewBag.Id" != "") {
            $('#Id').val('@Model.Id');
            $('#ProductDate').val('@Model.ProductDate');
            $('#InBox').val('@Model.InBox');
            $('#ModelName').val('@Model.ModelName');
            $('#ModelNumber').val('@Model.ModelNumber');
            $('#Manufacture').selectpicker("val", "@Model.ManufactureId");
            $('#AccessoryType').selectpicker("val", "@Model.AccessoryTypeId");
            $('#Dimension').val('@Model.Dimension');
            $('#Weight').val('@Model.Weight');
            $('#NoteSummary').val('@Model.NoteSummary');
            $('#WarrantySummary').val('@Model.WarrantySummary');
            $('#MRP').val('@Model.MRP.Amount.Value.ToString("f2")');
            }
        });
    </script>

}
